package com.hanoi.wiki.model.json;

import java.io.Serializable;
import java.util.Date;

import org.codehaus.jackson.map.annotate.JsonSerialize;

import com.hanoi.wiki.common.DateSerializer;
import com.hanoi.wiki.model.User;
import com.hanoi.wiki.model.UserStatistic;

public class UserStatisticJson extends BaseJsonObject implements Serializable{
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	private int id;	
	private String recentPlace;
	private String detail;
	private int status;
	private Date date;
	private int user;
	
	public UserStatisticJson() {
		
	}
	
	public UserStatisticJson(UserStatistic statistic) {
		if(statistic != null) {
			this.id = statistic.getId();
			this.recentPlace = statistic.getRecentPlace();
			this.detail = statistic.getDetail();
			this.status = statistic.getStatus();
			this.date = statistic.getDate();
			
			User user = statistic.getUser();
			if(user != null) {
				this.user = user.getId();
			}
		}
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getRecentPlace() {
		return recentPlace;
	}

	public void setRecentPlace(String recentPlace) {
		this.recentPlace = recentPlace;
	}

	public String getDetail() {
		return detail;
	}

	public void setDetail(String detail) {
		this.detail = detail;
	}

	public int getStatus() {
		return status;
	}

	public void setStatus(int status) {
		this.status = status;
	}

	@JsonSerialize(using=DateSerializer.class)
	public Date getDate() {
		return date;
	}

	public void setDate(Date date) {
		this.date = date;
	}

	public int getUser() {
		return user;
	}

	public void setUser(int user) {
		this.user = user;
	}
	
	
}
